// pages/movie/movie-detail/movie-detail.js
var app = getApp()
var util = require('../../util/util.js')
var movieUrl = app.globalData.g_doubanMovieUrl
Page({
  data:{
      post:'',
      title:'',
      country:'',
      year:'',
      loveNum:0,
      commentNum:0,
      rating:{},
      products:[],
      director:'',
      actors:'',
      movieType:'',
      summary:''
  },
  onLoad:function(options){
    var url = movieUrl+options.id
    var that = this
    util.getDoubanMsg(url,function(data){
      var movie = util.resolveDoubanMovie(data)
      that.setData(movie)
    })
  },
  viewPostImg:function(event){
    var url = event.target.dataset.src
    console.log(url)
      if(url){
        wx.previewImage({
          current: url,
          urls: [url],
          success: function(res){
            // success
          },
          fail: function() {
            // fail
          },
          complete: function() {
            // complete
          }
        })
      }
  }
  
})